
<!--_meta 作为公共模版分离出去-->
{include file="public/_meta"}

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 下载管理 <span class="c-gray en">&gt;</span>个人消息<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form action="" method="get">
		<div class="text-c">

		</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a href="javascript:;" onclick="dataDel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
		</span>
		<span class="r">共有数据：<strong></strong> 条</span> </div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-hover table-bg table-sort">
			<thead>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th width="100">微信昵称</th>
				<th width="100">备注名</th>
				<th width="90">发布日期</th>
				<th width="">操作</th>
			</tr>
			</thead>
			<tbody>
			{volist name="data" id="vo"}
			<tr class="text-c">
				<td><input class="checkbox" type="checkbox" value="{$vo.id}" name="id[]"></td>
				<td>
					{if condition="$vo.nickname eq null"}
					暂无
					{else/}
					<a href="javascript:void(0);" style="cursor:pointer" class="text-primary" onclick="member_show('{$vo.nickname}','{:url(\'download_info/download_details\')}?id={$vo.id}','{$vo.id}','500','450')"><u><b>{$vo.nickname}</b></u></a>
					{/if}
				</td>
				<td>
					{if condition="$vo.remark eq null"}
					暂无
					{else/}
					<a href="javascript:void(0);" style="cursor:pointer" class="text-primary" onclick="member_show('{$vo.remark}','{:url(\'download_info/download_details\')}?id={$vo.id}','{$vo.id}','500','450')"><u><b>{$vo.remark}</b></u></a>
				{/if}
				</td>
				<td>{$vo.time/1000|date="Y-m-d",###}</td>
				<td class="td-manage">
					<a title="下载" href="{:url('download_info/download')}?id={$vo.id}"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe640;</i></a>
					<a title="删除" href="javascript:;" onclick="del_download(this,'{$vo.id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
				</td>
			</tr>
			{/volist}
			</tbody>
		</table>
	</div>
</div>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer"}


<script type="text/javascript">
	$(function(){
		$('.table-sort').dataTable({
			"aaSorting": [[ 1, "asc" ]],//默认第几个排序
			"bStateSave": true,//状态保存
			"aoColumnDefs": [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{"orderable":false,"aTargets":[0]}// 制定列不参与排序
			]
		});

	});
	/*用户-添加*/
	function add_member(title,url,w,h){
		layer_show(title,url,w,h);
	}
	/*用户-查看*/
	function member_show(title,url,id,w,h){
		layer_show(title,url,w,h);
	}


	/*用户-删除*/
	function del_download(obj,id){
		layer.confirm('确认要删除吗？',function(index){
			$.ajax({
				type: 'post',
				url: "{:url('member/del_member')}",
				dataType: 'json',
				data: {id:id},
				success: function(msg){
					if(msg.status == true){
						$(obj).parents("tr").remove();
						layer.msg(msg.message,{icon:1,time:1000});
					}else if(msg.status == false){
						layer.msg(msg.message,{icon:5,time:1000});
					}
				},
				error:function(data) {
					console.log(data.msg);
				}
			});
		});
	}

	//批量删除
	function dataDel(){
		layer.confirm('确认要删除吗？',function(index){
			var member_id =[];
			$('input[name="id[]"]:checked').each(function(){
				member_id.push($(this).val());
			});
			if(member_id.length == 0){
				layer.msg('请勾选要删除的记录',{icon:2,time:2000});return;
			}
			$.ajax({
				type: 'post',
				url: "{:url('member/batch_del_member')}",
				dataType: 'json',
				data: {id:member_id},
				success: function(msg){
					if(msg.status == true){
						layer.msg(msg.message,{icon:6,time:1000});
						setTimeout(jump,1000);
						function jump(){
							window.location.reload();
						}
					}else if(msg.status == false){
						layer.msg(msg.message,{icon:5,time:1000});
					}
				}
			});
		});
	}

	/*下载*/
	function down(obj,url,date,remark){
		$.ajax({
			type: 'post',
			url: "",
			dataType: 'json',
			data: {
				file_url:url,
				date:date,
				remark:remark
			},
			success: function(msg){
				if(msg.status == true){
					layer.msg(msg.message,{icon:1,time:3000});
				}else if(msg.status == false){
					layer.msg(msg.message,{icon:5,time:3000});
				}
			},
			error:function(data) {
				console.log(data.msg);
			}
		});
	}
</script>
